package gui2.g1;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class Painting extends JFrame {

	private JPanel p = new JPanel() {

		protected void paintComponent(java.awt.Graphics g) {

			super.paintComponent(g);
			
			Graphics2D g2 = (Graphics2D)g;
			g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
			
			g.setColor(Color.BLUE);
			g.drawRect(50, 50, 200, 100);
			g.setColor(Color.RED);
			g.drawOval(25, 25, 380, 380);
		};
	};

	{
		getContentPane().add(p);
		p.setPreferredSize(new Dimension(500, 500));
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		pack();
	}

	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {

			@Override
			public void run() {
			
				
				new Painting().setVisible(true);
			}
		});
	}

}
